import Vue from "vue";
import VueRouter from "vue-router";
import layout from "../views/LayoutView.vue";
import login from "../views/login/IndexView.vue";
Vue.use(VueRouter);

const routes = [
  {
    path: "/",
    component: login,
  },
  {
    path: "/login",
    component: login,
  },
  {
    path: "/app",
    component: layout,
    redirect: "/app/project",
    children: [
      {
        path: "project",
        name: "project",
        component: () => import("../views/project/IndexView.vue"),
      },
      {
        path: "user",
        name: "user",
        component: () => import("../views/user/IndexView.vue"),
      },
      {
        path: "projectDetail",
        name: "projectDetail",
        component: () => import("../views/project/ProjectDetail.vue"),
        redirect: "/app/projectDetail/SchemeDescription",
        children: [
          {
            path: "Capability",
            name: "Capability",
            component: () =>
              import("../views/project/capability/CapabilityDecomposition.vue"),
          },
          {
            path: "SchemeDeduction",
            name: "SchemeDeduction",
            component: () =>
              import("../views/project/schemeDeduction/SchemeDeduction.vue"),
          },
          {
            path: "SchemeDescription",
            name: "SchemeDescription",
            component: () =>
              import(
                "../views/project/schemeDescription/SchemeDescription.vue"
              ),
          },
          {
            path: "SchemeDesign",
            name: "SchemeDesign",
            component: () =>
              import("../views/project/schemeDesign/SchemeDesign.vue"),
          },
        ],
      },
      {
        path: "createTask",
        name: "createTask",
        component: () => import("../views/project/task/CreateTask.vue"),
      },
      {
        path: "editTask",
        name: "editTask",
        component: () => import("../views/project/task/EditTask.vue"),
      },
      {
        path: "projectDetail/SchemeDesign/createDesign",
        name: "createDesign",
        component: () =>
          import("../views/project/schemeDesign/CreateDesign.vue"),
      },
      {
        path: "projectDetail/SchemeDesign/editDesign",
        name: "editDesign",
        component: () => import("../views/project/schemeDesign/EditDesign.vue"),
      },
      {
        path: "equip",
        name: "equip",
        component: () => import("../views/equip/IndexView.vue"),
        redirect: "/app/equip/AllegationView",
        children: [
          {
            path: "red",
            name: "red",
            component: () => import("../views/equip/IndexView.vue"),
            children: [
              {
                path: "AllegationView",
                name: "AllegationViewRed",
                component: () => import("../views/equip/red/AllegationView.vue"),
              },
              {
                path: "dataLink",
                name: "dataLinkRed",
                component: () => import("../views/equip/red/DataLink.vue"),
              },
              {
                path: "PlatformView",
                name: "PlatformViewRed",
                component: () => import("../views/equip/red/PlatformView.vue"),
              },
              {
                path: "SensorView",
                name: "SensorViewRed",
                component: () => import("../views/equip/red/SensorView.vue"),
              },
              {
                path: "WeaponView",
                name: "WeaponViewRed",
                component: () => import("../views/equip/red/WeaponView.vue"),
              },
              {
                path: "deviceView",
                name: "deviceViewRed",
                component: () => import("../views/equip/red/component/deviceView.vue"),
              },
            ]
          },
          {
            path: "blue",
            name: "blue",
            component: () => import("../views/equip/IndexView.vue"),
            children: [
              {
                path: "AllegationView",
                name: "AllegationViewBlue",
                component: () => import("../views/equip/blue/AllegationView.vue"),
              },
              {
                path: "dataLink",
                name: "dataLinkBlue",
                component: () => import("../views/equip/blue/DataLink.vue"),
              },
              {
                path: "PlatformView",
                name: "PlatformViewBlue",
                component: () => import("../views/equip/blue/PlatformView.vue"),
              },
              {
                path: "SensorView",
                name: "SensorViewBlue",
                component: () => import("../views/equip/blue/SensorView.vue"),
              },
              {
                path: "WeaponView",
                name: "WeaponViewBlue",
                component: () => import("../views/equip/blue/WeaponView.vue"),
              },
              {
                path: "deviceView",
                name: "deviceView",
                component: () => import("../views/equip/blue/component/deviceView.vue"),
              },
            ]
          },

        ],
      },
      {
        path: "capacity",
        name: "capacity",
        component: () => import("../views/capacity/IndexView.vue"),
        redirect: "/app/capacity/CapacityOne",
        children: [
          {
            path: "CapacityOne",
            name: "CapacityOne",
            component: () => import("../views/capacity/CapacityOne.vue"),
          },
          {
            path: "CapacityTwo",
            name: "CapacityTwo",
            component: () => import("../views/capacity/CapacityTwo.vue"),
          },
          {
            path: "CapacityThree",
            name: "CapacityThree",
            component: () => import("../views/capacity/CapacityThree.vue"),
          },
          {
            path: "CapacityFour",
            name: "CapacityFour",
            component: () => import("../views/capacity/CapacityFour.vue"),
          },
          {
            path: "CapacityFive",
            name: "CapacityFive",
            component: () => import("../views/capacity/CapacityFive.vue"),
          },
          {
            path: "CapacitySix",
            name: "CapacitySix",
            component: () => import("../views/capacity/CapacitySix.vue"),
          },
          {
            path: "CapacitySeven",
            name: "CapacitySeven",
            component: () => import("../views/capacity/CapacitySeven.vue"),
          },
          {
            path: "CapacityEight",
            name: "CapacityEight",
            component: () => import("../views/capacity/CapacityEight.vue"),
          },
          {
            path: "CapacityNine",
            name: "CapacityNine",
            component: () => import("../views/capacity/CapacityNine.vue"),
          },
          {
            path: "CapacityTen",
            name: "CapacityTen",
            component: () => import("../views/capacity/CapacityTen.vue"),
          },
          {
            path: "CapabilityView",
            name: "CapabilityView",
            component: () =>
              import("../views/capacity/component/CapabilityView.vue"),
          },
        ],
      },
      {
        path: "estimate",
        name: "estimate",
        component: () => import("../views/estimate/IndexView.vue"),
        redirect: "/app/estimate/EstimateOne",
        children: [
          {
            path: "EstimateOne",
            name: "EstimateOne",
            component: () => import("../views/estimate/EstimateOne.vue"),
          },
          {
            path: "EstimateTwo",
            name: "EstimateTwo",
            component: () => import("../views/estimate/EstimateTwo.vue"),
          },
          {
            path: "EstimateThree",
            name: "EstimateThree",
            component: () => import("../views/estimate/EstimateThree.vue"),
          },
          {
            path: "EstimateFour",
            name: "EstimateFour",
            component: () => import("../views/estimate/EstimateFour.vue"),
          },
          {
            path: "EstimateFive",
            name: "EstimateFive",
            component: () => import("../views/estimate/EstimateFive.vue"),
          },
          {
            path: "EstimateSix",
            name: "EstimateSix",
            component: () => import("../views/estimate/EstimateSix.vue"),
          },
          {
            path: "EstimateSeven",
            name: "EstimateSeven",
            component: () => import("../views/estimate/EstimateSeven.vue"),
          },
          {
            path: "EstimateEight",
            name: "EstimateEight",
            component: () => import("../views/estimate/EstimateEight.vue"),
          },
          {
            path: "EstimateNine",
            name: "EstimateNine",
            component: () => import("../views/estimate/EstimateNine.vue"),
          },
          {
            path: "EstimateTen",
            name: "EstimateTen",
            component: () => import("../views/estimate/EstimateTen.vue"),
          },
        ],
      },
      {
        path: "editScheme",
        name: "editScheme",
        component: () =>
          import(
            "../views/recommend/EditDesign.vue"
          ),
      },
      {
        path: "createScheme",
        name: "createScheme",
        component: () =>
          import("../views/recommend/CreateDesign.vue"),
      },
      {
        path: "RecommendScheme",
        name: "RecommendScheme",
        component: () =>
          import("../views/recommend/RecommendScheme.vue"),
      },
    ],
  },
];

const router = new VueRouter({
  mode: "hash",
  base: process.env.BASE_URL,
  routes,
});
let originPush = VueRouter.prototype.push;
VueRouter.prototype.push = function (location, resolve, reject) {
  if (resolve && reject) {
    originPush.call(this, location, resolve, reject);
  } else {
    originPush.call(
      this,
      location,
      () => { },
      () => { }
    );
  }
};

export default router;
